package tda366.tilemap;

import java.awt.Color;
import java.awt.Dimension;

public class TileMapModel {
	
	private ITile[][] tileMapState;
	private Dimension tileMapSize = new Dimension(20,20);
	private ITile roundTile = new RoundTile(Color.BLACK);
	private ITile recTile= new RectangularTile(Color.CYAN);
	
	public TileMapModel(){
		tileMapState = new ITile[tileMapSize.height][tileMapSize.width];
		
		for(int i = 0; i < 20; i++){
			for(int j = 0; j < 20; j++){
				if((i+j)%2 == 0){
					setTileMapState(i, j, roundTile);
				}else{
					setTileMapState(i, j, recTile);
				}
			}
		}
	}
	
	public void setTileMapState(int x, int y, ITile tile){
		tileMapState[x][y] = tile;
	}
	
	public ITile getTileMapState(int x, int y) {
		return tileMapState[x][y];
	}
	
	public Dimension getTileMapSize() {
		return tileMapSize;
	}
	
	public void updateTileMap(int x, int y){
		setTileMapState(x, y, recTile);		
	}
}
